<template>
	<div class="user-info">
		<div class="user-info-avatar">
			<img src="" alt="user avatar">
			<span class="iconfont icon-user"></span>
		</div>
		<div class="user-info-detail" v-if="user">
			<div class="user-info-detail-name">
				{{user.nick || '暂无用户名'}}
			</div>
			<div class="user-info-detail-integral">
				<span>积分：</span>
				<span>{{user.source}}</span>
			</div>
		</div>
		<router-link to="/login" tag="div" class="user-info-detail" v-else>
			<div class="user-info-detail-name">
				点击登录
			</div>
			<div class="user-info-detail-integral">
				<span>积分：</span>
				<span>0</span>
			</div>
		</router-link>
	</div>
</template>

<script>
	export default {
		name: "Info",
		props: {
			user: Object,
			required: true
		}
	}
</script>
